<!DOCTYPE html>
<html lang="zh-cn">
<head>
	{template wxshare}
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<title>{if $record['type']==1}充值 - {php echo $this->module['config']['sname']}{else}支付订单 - {php echo $this->module['config']['sname']}{/if}</title>
	<meta name="format-detection" content="telephone=no, address=no">
	<meta name="apple-mobile-web-app-capable" content="yes" /> <!-- apple devices fullscreen -->
	<meta name="apple-touch-fullscreen" content="yes"/>
	<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
	<link href="{$_W['siteroot']}app/resource/css/font-awesome.min.css" rel="stylesheet">
	<link rel="stylesheet" href="{WELIAM_INDIANA_STATIC}components/weui/weui.css">
	<meta content="telephone=no" name="format-detection">
	<link href="{WELIAM_INDIANA_STATIC}css/common.css" rel="stylesheet">
	<link href="{WELIAM_INDIANA_STATIC}css/pay.css" rel="stylesheet">
	<script type="text/javascript" src="{$_W['siteroot']}app/resource/js/lib/jquery-1.11.1.min.js"></script>
</head>
<body>
<style>
	body{background:#EEE;}
	.container-fill{}
	h4{margin:15px 0;}
	h4:first-of-type{margin-top:10px;}
	.panel{padding:.5em; margin-bottom:10px;}
	.nav.nav-tabs{margin-bottom:.8em;}
	.alert .form-group{margin-bottom:0;}
	label.form-group{display:block;}
	label.form-group{font-weight:normal; overflow:hidden; border-top:1px #DDD solid; padding-top:10px;padding-bottom:0;margin-bottom:0 }
	label.form-group .col-xs-2{margin-top:0px;}
	label.form-group input[name="type"]{opacity:0; width:0;}
	#wq_card .form-group{border-top:none;border-bottom:1px solid #ccc;}
	#wq_card .form-group .col-xs-2{margin-top:15px;}
	#wq_card .form-group:last-child{border-bottom:none}
	.list-group-item{border: 1px solid #FFF;}
	.tr-main{background-color: #FFFFFF;border-top: 1px solid rgba(222,222,220,0.8);border-bottom: 1px solid rgba(222,222,220,0.8);padding-left: 15px;margin-top: 20px;}
	.tr-main p{display: block;heightu: 44px;line-height: 44px;border-bottom: 1px solid rgba(222,222,220,0.8);color: #333333;position: relative; font-size: 15px}
	.tr-main p:last-child{border-bottom:none;}
	p{margin: 0 0 0px;}
	.pull-right{margin-right: 8px;}
	.btn-success{background-color: #04BE02;border-color: #04BE02;}
</style>
<div class="m-simpleHeader" id="pro-view-0">
	<a href="javascript:history.go(-1);" data-pro="back" data-back="true" class="m-simpleHeader-back">
		<i class="ico ico-back">
		</i>
	</a>
	<h1>
		{if $record['type']==1}充值{else}支付订单{/if}
	</h1>
</div>
<div class="m-pay-order">
	{if $record['type']!=1}
	<div data-pro="list">
		<div id="pro-view-1">
			<div data-pro="entry" class="m-pay-order-list">
				{loop $thisCart $cart}
				<div class="m-pay-order-list-item" id="pro-view-2">
					<span class="m-pay-order-list-item-name">{$cart['title']}</span><span class="m-pay-order-list-item-num"><b class="txt-red">{$cart['num']}</b>人次</span>
				</div>
				{/loop}
				<input type="hidden" id="openid" name="openid" value="{$record['openid']}" />
				<input type="hidden" id="uniacid" name="uniacid" value="{$record['uniacid']}" />
				<input type="hidden" id="ordersn" name="ordersn" value="{$params['tid']}" />
			</div>
			<div class="m-pay-order-total">
				商品合计：<b class="txt-red">{$money}夺宝币</b>
			</div>
		</div>
	</div>
	{/if}
	<input type="hidden" id="money" name="money" value="{$money}" />
	<div data-pro="options" class="m-pay-order-options" id="choose">
		{if $record['type']!=1}
		<div class="w-checkBar w-bar w-checkBar-disabled " id="" onclick="chgclass(this,'credit2')">
			<span id="pro-view-23">余额支付（余额：{$thismember['credit2']}夺宝币）<span class="txt-red w-bar-extText">{$money}夺宝币</span></span>
			<div class="w-bar-ext">
				<b data-pro="switcher" class="w-checkbox">
				</b>
				<input type="checkbox" disabled="disabled">
			</div>
		</div>
		{/if}
		{if $this->module['config']['wxpaystatus'] == 2}
		{if !empty($pay['yunpay']['switch'])}
		<div class="w-checkBar w-bar w-checkBar-checked" id="" onclick="chgclass(this,'yunpay')">
			<span id="pro-view-24">微信云支付<span class="txt-red w-bar-extText">{$money}.00元</span></span>
			<div class="w-bar-ext">
				<b data-pro="switcher" class="w-checkbox">
				</b>
				<input type="checkbox">
			</div>
		</div>
		{/if}
		{else}
		{if !empty($pay['wechat']['switch'])}
		<div class="w-checkBar w-bar w-checkBar-checked" id="" onclick="chgclass(this,'weixin')">
			<span id="pro-view-24">微信支付<span class="txt-red w-bar-extText">{$money}.00元</span></span>
			<div class="w-bar-ext">
				<b data-pro="switcher" class="w-checkbox">
				</b>
				<input type="checkbox">
			</div>
		</div>
		{/if}
		{/if}
		{if !empty($pay['alipay']['switch'])}
		<div class="w-checkBar w-bar w-checkBar-disabled" id="" onclick="chgclass(this,'alipay')">
			<span id="pro-view-24">支付宝支付<span class="txt-red w-bar-extText">{$money}.00元</span></span>
			<div class="w-bar-ext">
				<b data-pro="switcher" class="w-checkbox">
				</b>
				<input type="checkbox" disabled="disabled">
			</div>
		</div>
		{/if}
		{if !empty($pay['unionpay']['switch'])}
		<div class="w-checkBar w-bar w-checkBar-disabled" id="" onclick="chgclass(this,'unionpay')">
			<span id="pro-view-24">银联支付<span class="txt-red w-bar-extText">{$money}.00元</span></span>
			<div class="w-bar-ext">
				<b data-pro="switcher" class="w-checkbox">
				</b>
				<input type="checkbox" disabled="disabled">
			</div>
		</div>
		{/if}
		{if !empty($pay['baifubao']['switch'])}
		<div class="w-checkBar w-bar w-checkBar-disabled" id="" onclick="chgclass(this,'baifubao')">
			<span id="pro-view-24">百度钱包支付<span class="txt-red w-bar-extText">{$money}.00元</span></span>
			<div class="w-bar-ext">
				<b data-pro="switcher" class="w-checkbox">
				</b>
				<input type="checkbox" disabled="disabled">
			</div>
		</div>
		{/if}
	</div>
	{if !empty($mine)}
		{loop $mine $mi}
		<p>{$mi['name']} :<span class="pull-right">{$mi['value']}</span></p>
		{/loop}
	{/if}	
</div>
{if $this->module['config']['wxpaystatus'] == 2}
<div class="clearfix" style="border-radius: 0px;display:block;padding: .5em;" id="yunpay">
	<div class="tab-content">
		<!-- 直接到账 -->
		<div class="tab-pane animated active fadeInLeft" id="direct">
			{if !empty($pay['yunpay']['switch'])}
			<div class="pay-btn" id="wechat-panel">
				<form action="{php echo $this->createMobileUrl('cash',array('type'=>'yunpay','params'=>base64_encode(json_encode($params)),'card_id'=>base64_encode($card_id),'cart_type'=>$record['buystatus']))}" method="post">
					<input type="hidden" name="params" value="{php echo base64_encode(json_encode($params));}" />
					<input type="hidden" name="encrypt_code" value="" />
					<input type="hidden" name="card_id" value="{php echo base64_encode($card_id);}" />
                    <input type="hidden" id="cart_type" name="cart_type" value="{$record['buystatus']}" />
					<input type="hidden" name="coupon_id" value="" />
					<button class="weui_btn weui_btn_primary" disabled="disabled" type="submit" id="wBtn" value="wechat" style="height: 42px; font-size: 18px;">支付</button>
				</form>
			</div>
			<script type="text/javascript">
				document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
					$('#wBtn').removeAttr('disabled');
					$('#wBtn').html('微信云支付');
				});
			</script>
			{/if}
		</div>
	</div>
</div>
{else}
<div class="clearfix" style="border-radius: 0px;display:block;padding: .5em;" id="weixin">
	<div class="tab-content">
		<!-- 直接到账 -->
		<div class="tab-pane animated active fadeInLeft" id="direct">
			{if !empty($pay['wechat']['switch'])}
			<div class="pay-btn" id="wechat-panel">
				<form action="{php echo url('mc/cash/wechat');}" method="post">
					<input type="hidden" name="params" value="{php echo base64_encode(json_encode($params));}" />
					<input type="hidden" name="encrypt_code" value="" />
					<input type="hidden" name="card_id" value="{php echo base64_encode($card_id);}" />
					<input type="hidden" name="coupon_id" value="" />
					<button class="weui_btn weui_btn_primary" disabled="disabled" type="submit" id="wBtn" value="wechat" style="height: 42px; font-size: 18px;">支付</button>
				</form>
			</div>
			<script type="text/javascript">
				document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
					$('#wBtn').removeAttr('disabled');
					$('#wBtn').html('微信支付');
				});
			</script>
			{/if}
		</div>
	</div>
</div>
{/if}
<div class="clearfix" style="border-radius: 0px;display: none;padding: .5em;" id="alipay">
	<div class="tab-content">
		<!-- 直接到账 -->
		<div class="tab-pane animated active fadeInLeft" id="direct">
			{if !empty($pay['alipay']['switch'])}
			<div class="pay-btn" id="alipay-panel">
				<form action="{php echo url('mc/cash/alipay');}" method="post">
					<input type="hidden" name="params" value="{php echo base64_encode(json_encode($params));}" />
					<input type="hidden" name="encrypt_code" value="" />
					<input type="hidden" name="card_id" value="{php echo base64_encode($card_id);}" />
					<input type="hidden" name="coupon_id" value="" />
					<button class="weui_btn weui_btn_primary" type="submit" name="alipay" style="height: 42px; font-size: 18px;">支付宝支付</button>
				</form>
			</div>
			{/if}
		</div>
	</div>
</div>
<div class="clearfix" style="border-radius: 0px;display: none;padding: .5em;" id="unionpay">
	<div class="tab-content">
		<!-- 直接到账 -->
		<div class="tab-pane animated active fadeInLeft" id="direct">
			{if $pay['unionpay']['switch']}
			<div class="pay-btn" id="unionpay-panel">
				<form action="{php echo url('mc/cash/unionpay');}" method="post">
					<input type="hidden" name="params" value="{php echo base64_encode(json_encode($params));}" />
					<input type="hidden" name="encrypt_code" value="" />
					<input type="hidden" name="card_id" value="{php echo base64_encode($card_id);}" />
					<input type="hidden" name="coupon_id" value="" />
					<button class="weui_btn weui_btn_primary" type="submit" name="unionpay" style="height: 42px; font-size: 18px;">银联支付</button>
				</form>
			</div>
			{/if}
		</div>
	</div>
</div>
<div class="clearfix" style="border-radius: 0px;display: none;padding: .5em;" id="baifubao">
	<div class="tab-content">
		<!-- 直接到账 -->
		<div class="tab-pane animated active fadeInLeft" id="direct">
			{if $pay['baifubao']['switch']}
			<div class="pay-btn" id="baifubao-panel">
				<form action="{php echo url('mc/cash/baifubao');}" method="post">
					<input type="hidden" name="params" value="{php echo base64_encode(json_encode($params));}" />
					<input type="hidden" name="encrypt_code" value="" />
					<input type="hidden" name="card_id" value="{php echo base64_encode($card_id);}" />
					<input type="hidden" name="coupon_id" value="" />
					<button class="weui_btn weui_btn_primary" type="submit" name="baifubao" style="height: 42px; font-size: 18px;">百度钱包支付</button>
				</form>
			</div>
			{/if}
		</div>
	</div>
</div>
<div class="clearfix" style="border-radius: 0px;display: none;padding: .5em;" id="credit2" >
	<div class="tab-content">
		<div class="tab-pane animated active fadeInLeft" id="direct">
			<div class="pay-btn" id="wechat-panel">
					<button class="weui_btn weui_btn_primary" disabled="disabled" type="submit" id="wBtn2" value="" style="height: 42px; font-size: 18px;">支付</button>
			</div>
			<script type="text/javascript">
				document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
					$('#wBtn2').removeAttr('disabled');
					$('#wBtn2').html('余额支付');
				});
				$('#wBtn2').bind('click',function(){
					var openid = $('#openid').val();
					var uniacid = $('#uniacid').val();
					var ordersn = $('#ordersn').val();
					
					$.post("{php echo $this->createMobileUrl('pay',array('type'=>'credit2'))}",{openid:openid,uniacid:uniacid,ordersn:ordersn},function(d){
						
						if(d.result==1){
							tip("余额支付成功!",true);
							var url ="{php echo $this->createMobileUrl('endbuy');}&money="+money;
							location.href=url;
						}else{
							tip(d.why,true);
						}
					},"json");
					
				});
			</script>
		</div>
	</div>
</div>
{template 'common_message'}
<input type="hidden" name="token" value="{$_W['token']}" />
<script>
	function chgclass(o,type) {
	var u = document.getElementById('choose');
	var c = u.childNodes;
	for (var i = 0; i < c.length; i++) {
		if (c[i].tagName && c[i].tagName.toLowerCase() == 'div') {
			if (c[i] == o) {
				c[i].className = 'w-checkBar w-bar w-checkBar-checked';
				if(type=='weixin'){
					$('#weixin').show();
					$('#yunpay').hide();
					$('#credit2').hide();
					$('#alipay').hide();
					$('#unionpay').hide();
					$('#baifubao').hide();
				}
				if(type=='yunpay'){
					$('#weixin').hide();
					$('#yunpay').show();
					$('#credit2').hide();
					$('#alipay').hide();
					$('#unionpay').hide();
					$('#baifubao').hide();
				}
				if(type=='credit2'){
					$('#weixin').hide();
					$('#yunpay').hide();
					$('#credit2').show();
					$('#alipay').hide();
					$('#unionpay').hide();
					$('#baifubao').hide();
				}
				if(type=='alipay'){
					$('#weixin').hide();
					$('#yunpay').hide();
					$('#credit2').hide();
					$('#alipay').show();
					$('#unionpay').hide();
					$('#baifubao').hide();
				}
				if(type=='unionpay'){
					$('#weixin').hide();
					$('#yunpay').hide();
					$('#credit2').hide();
					$('#alipay').hide();
					$('#unionpay').show();
					$('#baifubao').hide();
				}
				if(type=='baifubao'){
					$('#weixin').hide();
					$('#yunpay').hide();
					$('#credit2').hide();
					$('#alipay').hide();
					$('#unionpay').hide();
					$('#baifubao').show();
				}
			} else {
				c[i].className = 'w-checkBar w-bar w-checkBar-disabled';
			}
		}
	}
}
</script>
{template 'common/footer'}